enable app to app service the following diagram illustrates the flows of the app-to-app apis for payment card push provisioning bank appsamsung wallet apptoken service providerref[checking samsungpay status]section in common flowalt[if neccessary optional ]1cardmanager getallcards 2onsuccess card cardid, card cardstatus 3request card information with card cardid4success5samsungpay getwalletinfo 6onsuccess device_id, wallet_user_id 7create provisioningpayloadwith card information & wallet informationrefer to card networks spec8cardmanager addcard payload 9request token provision10success11onsuccess figure flows of push provisioning apis the main classes involved are samsung pay – for fetching samsung pay app status and wallet information on the device paymentmanager – for card provisioning and invoking favorite cards payment functionalities cardmanager – for payment card management watchmanager – for all functions related to samsung pay watch let’s now take a look at how each one works in the context of your bank app requesting registered card list in the samsung pay the'getallcards method of the cardmanager class is used to request a list of all cards currently registered/enrolled in samsung pay on the same device running the issuer’s app to succeed, the issuer app must pass valid partnerinfo to 'cardmanager' for caller verification 'cardfilter' narrows the card list returned by samsung pay to the issuername specified please be noted that getsamsungpaystatus must be called before getallcards getallcards could not return a cards list when getsamsungpaystatus responds with a code other than spay_ready noteto get the cards list of samsung pay watch, you have to use the watchmanager class instead of the cardmanager class as of api level sdk version 1 4, cardfilter retrieves this information from the samsung pay developers portal certain issuers may need to register multiple issuer name s with the portal, depending on their app and/or the requirements of their token service provider tsp the getallcards parameter cardfilter matches the issuer name s specified with those registered in the portal only complete matches are returned this method is typically called when your partner app wants to check the card status it does not need to be called every time the partner app resumes therefore, you should create the card list with the 'oncreate ' method, rather than the 'onresume ' method the result of a getallcards call is delivered to getcardlistener, which provides the following events onsuccess - called when the operation succeeds; provides the list of all filtered cards and their status card information includes cardid, cardstatus, and extra cardinfo data onfail - called when the operation fails here’s an example of how to use the 'getallcards ' api method in your issuer app bundle cardfilter = new bundle ; // since api level 1 4, cardfilter param is ignored partner does not need to use it here // it is retrieved from the samsung pay developers portal cardfilter putstring cardmanager extra_issuer_name, issuername ; cardmanager getallcards cardfilter, new getcardlistener { @override public void onsuccess list<card> cards { // getting card status is success if cards == null || cards isempty { log e tag,"no card is found" ; return; } else { // perform operation with card data for card s cards { log d tag,"cardid "+ s getcardid +"cardstatus "+s getcardstatus ; // get extra card data if s getcardinfo != null { string cardid = s getcardid ; // since api level 2 13, id from card network string last4fpan = s getcardinfo getstring cardmanager extra_last4_fpan ; string last4dpan = s getcardinfo getstring cardmanager extra_last4_dpan ; string cardtype = s getcardinfo getstring cardmanager extra_card_type ; string cardissuername = s getcardinfo getstring cardmanager extra_issuer_name ; log d tag,"last4fpan "+last4fpan+" last4dpan "+ last4dpan + " cardid "+ cardid ; } } } } @override public void onfail int error, bundle errordata { // getting card status is failed } } ; getting wallet information the samsungpay class provides the getwalletinfo api method, which is called to request wallet information from the samsung pay app prior to calling the addcard api, when you want to avoid duplicate provisioning your issuer app uses this information to uniquely identify the user and the samsung pay app on a particular device wallet device management id, device id, and wallet user id noteto get wallet information of samsung pay watch, you have to use the watchmanager class instead of the cardmanager class void getwalletinfo list<string> keys, statuslistener callback the following example demonstrates how to use it // set the serviceid assigned by the samsung pay developers portal during service creation string serviceid = "sampleserviceid"; bundle bundle = new bundle ; bundle putstring samsungpay extra_issuer_name,"issuer name" ; bundle putstring samsungpay partner_service_type,samsungpay servicetype app2app tostring ; partnerinfo pinfo = new partnerinfo serviceid, bundle ; samsungpay samsungpay = new samsungpay context, pinfo ; // add bundle keys to get wallet information from samsung pay // this information can be delivered to the partner server for an eligibility check arraylist<string> keys = new arraylist<> ; keys add samsungpay wallet_user_id ; keys add samsungpay device_id ; samsungpay getwalletinfo keys, new statuslistener { @override public void onsuccess int status, bundle walletdata { // log d tag, "dowalletinfo onsuccess callback is called" ; // for visa, deviceid can be set to "clientdeviceid" as defined by visa string deviceid = walletdata get samsungpay device_id ; // for visa, walletuserid can be set to "clientwalletaccountid" as defined by visa string walletuserid = walletdata get samsungpay wallet_user_id ; } @override public void onfail int errorcode, bundle errordata { log e tag, "onfail callback is called, errorcode " + errorcode ; // check the extra error codes in the errordata bundle for all the reasons in // samsungpay extra_error_reason, when provided } } adding a card to samsung pay your issuer app calls the 'addcard ' api method of cardmanager to add a card to samsung pay by providing the required card details, your app can make it convenient and easy for users to add their bank-issued debit/credit cards to samsung pay directly from your app without additional steps, like switching between apps noteif you want to add a card to samsung pay watch, you have to use the 'watchmanager' class instead of the cardmanager class for most issuers, getwalletinfo suffices for requesting current wallet information the response from samsung pay tells the issuer app whether or not the user’s card has already been added to samsung pay or is ineligible for provisioning it is therefore recommended that you call getwalletinfo before displaying the add to samsung pay button if the card is eligible, display the “add” button and, if the user taps it, call addcard importantremember to obtain the governing issuer implementation guide s and specifications from the respective card network and implement each network’s required handling in your partner app and server the 'addcard ' result is delivered to addcardlistener, which provides the following events onsuccess - called when the operation succeeds; provides information and status regarding the added card onfail - called when the operation fails; returns the error code and extra bundle data such as extra_error_reason or extra_request_id if provided onprogress - called to indicate the current progress of the 'addcard ' operation; can be used to show a progress bar to the user in the issuer app this callback is supported for tsm solution issuers in china and spain here’s an example of how to use the addcard api method in your issuer app string cardtype = card card_type_credit; string tokenizationprovider = addcardinfo provider_abcd; // samsung pay does not provide detailed payload information; generate the provisioning payload in // accordance with your card network specifications string testpayload = "thisistestpayloadcardinfo1234567890"; bundle carddetail = new bundle ; carddetail putstring addcardinfo extra_provision_payload, testpayload ; addcardinfo addcardinfo = new addcardinfo cardtype, tokenizationprovider, carddetail ; cardmanager addcard addcardinfo, new addcardlistener { @override public void onsuccess int status, card card { log d tag, "onsuccess callback is called" ; } @override public void onfail int error, bundle errordata { log d tag, "onfail callback is called" ; check some extra error codes in the errordata bundle such as samsungpay extra_error_reason or samsungpay extra_request_id if provided } @override public void onprogress int currentcount, int totalcount, bundle bundledata { log d tag,"onprogress callback is called " + currentcount + " / " + totalcount ; } } ;